package com.xtkj.superclub_friendscircle.service.Impl;

import com.xtkj.commons.SnowflakeIdWorker;
import com.xtkj.superclub_entity.entity.friendsCircle.ShareComment;
import com.xtkj.superclub_entity.entity.friendsCircle.ShareReply;
import com.xtkj.superclub_friendscircle.dao.IShareCommentDao;
import com.xtkj.superclub_friendscircle.dao.IShareReplyDao;
import com.xtkj.superclub_friendscircle.service.ICommentReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 项目名称：superclub
 * 类 名 称：FriendsCircleCommentServiceImpl
 * 类 描 述：TODO
 * 创建时间：2020/1/6 11:11
 * 创 建 人：xiezhiyan
 */
@Service
public class CommentReplyServiceImpl implements ICommentReplyService {


    @Autowired
    private IShareCommentDao shareCommitDao;
    @Autowired
    private IShareReplyDao shareReplyDao;
    @Autowired
    private SnowflakeIdWorker snowflakeIdWorker;

    
    /**
     * @description 方法描述
     * 添加评论,将评论id数据到评论表
     * @return com.xtkj.commons.JsonResult
     * @author xiezhiyan
     * @date 2020/1/6 14:44
     */
    @Override
    public void friendsCircleComment(ShareComment shareComment) {
        //评论(雪花)id
        shareComment.setCommentId(snowflakeIdWorker.nextId()+"").setCreatedtm(new Date()).setUpdatedtm(new Date());
        shareCommitDao.insert(shareComment);
    }

   @Override
   public void friendsCircleReply(ShareReply shareReply){
        //回复(雪花)id
       shareReply.setReplyId(snowflakeIdWorker.nextId()+"");
       shareReplyDao.insert(shareReply);
    }
}